package com.boyue.utils;

import java.util.List;

/**
 * @auth wzy
 * @date 2023/9/2 14:20
 */
public class PageInfo<T> {

    /**
     * 页面大小
     */
    private Integer pageSize = 10;
    /**
     * 总记录数
     */
    private Integer count;
    /**
     * 当前页的记录集合
     */
    private List<T> pageList;
    /**
     * 当前页号
     */
    private Integer pageIndex = 1;
    /**
     * 总页数
     */
    private Integer totalPages;


    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public List<T> getPageList() {
        return pageList;
    }

    public void setPageList(List<T> pageList) {
        this.pageList = pageList;
    }

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getTotalPages() {
        this.totalPages = this.count / this.pageSize;
        if (this.count % pageSize != 0){
            this.totalPages++;
        }
        return this.totalPages;
    }

    public void setTotalPages(Integer totalPages) {
        this.totalPages = totalPages;
    }
}
